﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

using BizElements.Core;
using BizElements.TemplateEngine;

namespace BizElements.Generator
{
    public interface ICodeGenerator
    {
        event EventHandler<EventArgs<GenerationTraceItem>> ItemGenerated;
        event EventHandler<EventArgs<GenerationTraceItem>> GenerationCompleted;

        void GenerateCode();
        void StopGenerator();
    }

    public interface ICodeGeneratorProperties
    {
        string[] SelectedItems { get; set; }
        ITemplate[] ItemTemplates { get; set; }
        string OutputFolder { get; set; }
        string[] Validate();
        IDictionary<string, IDictionary<string, string>> AllComponentVariables { get; set; }
    }

    public sealed class GenerationTraceItem
    {
        public GenerationTraceItem(string message, int progressPercentage)
        {
            this.Message = message;
            this.ProgressPercentage = progressPercentage;
        }

        public string Message { get; private set; }
        public int ProgressPercentage { get; private set; }
    }

    public delegate ICodeGenerator CodeGeneratorBuilderMethod(ICodeGeneratorProperties properties);

    public delegate ICodeGeneratorProperties CodeGeneratorPropertiesBuilderMethod();
}